﻿using BasicModuleWebApiJWTAuthorization.DBContextx;
using BasicModuleWebApiJWTAuthorization.Model;
using BasicModuleWebApiJWTAuthorization.Module;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;

namespace BasicModuleWebApiJWTAuthorization.Controllers
{
    [Route("api/[controller]")]
    [ApiController]
    public class MemuPermissionController : ControllerBase
    {
        public MysqlDBContext mysqlDBContext { get; set; }

        public MemuPermissionController(MysqlDBContext xmysqlDBContext)
        {
            this.mysqlDBContext = xmysqlDBContext;
        }

        /// <summary>
        /// 菜单授权
        /// </summary>
        /// <param name="t_User"></param>
        /// <returns></returns>
        [HttpPost("UserPermission")]
        public IActionResult MemuPermission(UserPermission MemuPermission)
        {
            mysqlDBContext.userPermissions.Add(MemuPermission);
            mysqlDBContext.SaveChanges();
            return Ok("授权成功");
        }
    }
}
